repo: Add concurrency=send
authorColin Walters <walters@verbum.org>
Fri, 2 Apr 2021 13:47:02 +0000 (13:47 +0000)
committerColin Walters <walters@verbum.org>
Fri, 6 May 2022 16:53:56 +0000 (12:53 -0400)
Ultimately a repo is just a file descriptor wrapper with some
cached data, etc.  We can send it between threads, much like how
`gio::File` is `Send`.

Motivated by trying to write to a repo from a separate thread
in https://github.com/cgwalters/ostree-container

rust-bindings/rust/conf/ostree.toml
rust-bindings/rust/src/auto/repo.rs
rust-bindings/rust/src/auto/versions.txt
rust-bindings/rust/sys/src/auto/versions.txt

index 0cbdbb02d333885bd8e920af95ce7cec52d27d3e..372d05cbd5575bf37405d6bbfd0dc759640a5173 100644 (file)
@@ -139,6 +139,7 @@ status = "generate"
 [[object]]
 name = "OSTree.Repo"
 status = "generate"
+concurrency = "send"
     [[object.function]]
     # [MANUAL] we special-case the checksum value
     pattern = "^(write_content|write_content_async|write_metadata|write_metadata_async)$"
index 6cae471ca20fa4e25485d670b972bcd668f95109..ddae0cad0870184fd8185cd88375cc7350b38778 100644 (file)
@@ -1060,8 +1060,8 @@ impl Repo {
     //    unsafe { TODO: call ostree_sys:ostree_repo_traverse_parents_get_commits() }
     //}
 
-    pub fn connect_gpg_verify_result<F: Fn(&Repo, &str, &GpgVerifyResult) + 'static>(&self, f: F) -> SignalHandlerId {
-        unsafe extern "C" fn gpg_verify_result_trampoline<F: Fn(&Repo, &str, &GpgVerifyResult) + 'static>(this: *mut ostree_sys::OstreeRepo, checksum: *mut libc::c_char, result: *mut ostree_sys::OstreeGpgVerifyResult, f: glib_sys::gpointer) {
+    pub fn connect_gpg_verify_result<F: Fn(&Repo, &str, &GpgVerifyResult) + Send + 'static>(&self, f: F) -> SignalHandlerId {
+        unsafe extern "C" fn gpg_verify_result_trampoline<F: Fn(&Repo, &str, &GpgVerifyResult) + Send + 'static>(this: *mut ostree_sys::OstreeRepo, checksum: *mut libc::c_char, result: *mut ostree_sys::OstreeGpgVerifyResult, f: glib_sys::gpointer) {
             let f: &F = &*(f as *const F);
             f(&from_glib_borrow(this), &GString::from_glib_borrow(checksum), &from_glib_borrow(result))
         }
@@ -1073,6 +1073,8 @@ impl Repo {
     }
 }
 
+unsafe impl Send for Repo {}
+
 impl fmt::Display for Repo {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f, "Repo")
index cba716b0c81df35aa63a25d54320394e4e7e01e0..0d13f9dfed24531ae4ddc01b83498f170828a2ba 100644 (file)
@@ -1,2 +1,2 @@
 Generated by gir (https://github.com/gtk-rs/gir @ 2d1ffab)
-from gir-files (https://github.com/gtk-rs/gir-files @ b3c601f)
+from gir-files (https://github.com/gtk-rs/gir-files @ 9fe8b26)
index cba716b0c81df35aa63a25d54320394e4e7e01e0..0d13f9dfed24531ae4ddc01b83498f170828a2ba 100644 (file)
@@ -1,2 +1,2 @@
 Generated by gir (https://github.com/gtk-rs/gir @ 2d1ffab)
-from gir-files (https://github.com/gtk-rs/gir-files @ b3c601f)
+from gir-files (https://github.com/gtk-rs/gir-files @ 9fe8b26)